<?php
header("content-type:text/html; charset=utf-8");
$name=$_POST['username'];
$pass=$_POST['password'];
$qrmm=$_POST['password1'];
$email=$_POST['email'];
$phtonumber=$_POST['phtonumber'];
$encrypted=$_POST['encrypted'];
if($name=="" || $pass=="" || $qrmm=="" || $email=="" || $phtonumber=="" || $encrypted==""){
    echo "您的输入信息有误注册不成功，请重新注册！三秒钟后返回注册页面.........";
    header("refresh:3;url=sign.html");
}
else if($pass!=$qrmm){
    echo "两次输入的密码不一致! 请重新注册！三秒钟后返回注册页面.........";
    header("refresh:3;url=sign.html");
}
else{
    $serverLink=@mysql_connect("localhost","root","root") or die("连接服务器失败！程序中断");
    mysql_query("'set names 'utf-8'");
    $dbLink=@mysql_select_db("supermarket") or die("打开supermarket数据库失败！程序中断");
    $username="select * from admsign where admname='$name'";
    mysql_query($username);
    $returnsign=mysql_affected_rows();
    if($returnsign>0){
        header("refresh:3;url=sign.html");
           die('注册不成功，您的用户名已经被注册，请重新注册！三秒钟后返回注册页面.........');
        }
       $inputesign="insert into admsign(admname,password,email,phtonumber,encrypted) values('$name','$pass','$email','$phtonumber','$encrypted')";
        mysql_query($inputesign);
        $outsign=mysql_affected_rows();
        if($outsign>0){
            echo "恭喜您注册成功"."<br/>";
            echo "您注册的信息："."<br/>";
            echo  "用户名：".$name."<br/>";
            echo "密码：".$pass."<br/>";
            echo "邮箱：".$email."<br/>";
            echo "手机号码：".$phtonumber."<br/>";
            echo "密保：".$encrypted."<br/>";
            echo "<a href='login.html'>跳转到登录</a>";  
        }else{
            echo "您注册不成功，用户名或邮箱已经被注册，请重新注册";
            header("refresh:3;url=sign.html");
        }

        mysql_close($serverLink);
    }

?>